﻿using System;
using System.Web.Mvc;
using BabyShop.WebSite.Models;
using BabyShop.WebSite.Services;
using BabyShop.WebSite.ViewModels;

namespace BabyShop.WebSite.Areas.SysManage.Controllers
{
    public class ActionController : BaseController
    {
        private readonly ActionService _actionService = new ActionService();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Create()
        {
            return View(new Actions {ActionGuid = Guid.Empty});
        }

        [HttpPost]
        public ActionResult ActionList(JqGridViewModel jqGridViewModel)
        {
            string[] searchCols = new[]
                                      {
                                          "ActionGuid", "ActionName", "ControllerName", "AreaName",
                                          "ParentProductType.ProductTypeName",
                                          "CommonColumns.LastModified", "CommonColumns.IsDelete"
                                      };
            return Json(_actionService.GetJqGridSearchResult(jqGridViewModel, searchCols));
        }
    }
}
